package com.example.day2201;

/**
 * @author Lenovo
 */
public class MyString {
    public
    interface myString {
        String mySubString(String s, int x, int y);
    }

    public class MyStringDemo {
        public static void main(String[] args) {
            //Lambda简化写法
            useMyString((s, x, y) -> s.substring(x, y));
            //引用类的实例方法
            useMyString(String::substring);
        }
    }

    private static void useMyString(myString my) {
        String s = my.mySubString("HelloWorld", 2, 5);
        System.out.println(s);
    }
}